package com.yoyo.controller;

import com.yoyo.entity.PetType;
import com.yoyo.entity.ResultBulls;
import com.yoyo.service.PetTypeService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("type")
public class PetTypeController {
    @Resource
    private PetTypeService petTypeServiceImpl;

    @RequestMapping("all")
    @ResponseBody
    public ResultBulls show(){
        ResultBulls bulls = new ResultBulls();
        try{
            List<PetType> list =  petTypeServiceImpl.findAll(new PetType());
            bulls.setCode(200);
            bulls.setData(list);
        }catch (Exception e){
            e.printStackTrace();
            bulls.setCode(500);
        }
        return bulls;
    }
}
